<?php

use Monolog\Handler\StreamHandler;
use Monolog\Logger;

/**
 * Created by PhpStorm.
 * User: Wei
 * Date: 17/10/5
 * Time: 21:24
 */
//namespace cn\legendfamily\controller;
//require_once "../../vendor/autoload.php";

class BaseController
{
    protected $log; // 创建日志频道

    public function __construct()
    {
        $this->log = new Logger('name'); // 创建日志频道
        $this->log->pushHandler(new StreamHandler('./out.log', Logger::WARNING));

        // 添加日志记录
        $this->log->addWarning('Foo');
        $this->log->addError('Bar');
    }

    public function setSuccessData($data)
    {
        $data = ["httpCode" => 200, "msg" => "", "data" => $data];
        return json_encode($data, JSON_UNESCAPED_UNICODE);
    }

}